package com.sghd.candy.module.system.event;

import com.sghd.candy.module.common.event.LogoutEvent;
import com.sghd.candy.module.system.service.CacheService;
import com.sghd.common.event.AbstractReceiver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component("sys_LogoutEventReceiver")
public class LogoutEventReceiver extends AbstractReceiver<LogoutEvent> {
    @Autowired
    @Qualifier("initCacheService")
    private CacheService initCacheService;

    @Override
    public void doEvent(LogoutEvent event) {
        //回写数据
        initCacheService.writeBack(event.getOwner());
    }

    @Override
    public String[] getEventNames() {
        return new String[]{LogoutEvent.NAME};
    }

}
